package com.by.web;

import com.by.aop.User;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class UserController2 //extends BaseController
{
    @GetMapping(value="/user", consumes = "application/json", produces = "text/html",
            params = "mode=search", headers = "href=baidu")
    public User userMethod() {
        User user = new User();
        user.setId(1);
        user.setUsername("陈喜东");
        user.setBirtyDay(new Date());
        return user;
    }
    @GetMapping("/add")
    public User addUserMethod(User user) {

        return user;
    }

    @GetMapping(value = "/cookie" )
    public String getCookieVule(@CookieValue(name = "JSESSIONID", required = true, defaultValue = "") String sessionId) {

        return sessionId;
    }
}
